package com.woniuxy.mapper.provider;

import com.work.framework.pojo.Notice;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author kyle
 * @date 2019-09-28 14:21
 */
public class NoticeProvider {
    //声明表名
    private final String tableName = "notice";
    public String select(Notice notice) {
        SQL sql = new SQL() {
            {
                SELECT("*");
                FROM(tableName);
                if (notice.getSUid() != null) {
                    WHERE("s_uid = #{sUid}");
                }
                if (notice.getRUid() != null) {
                    WHERE("r_uid = #{rUid}");
                }
                if (notice.getMType() != null) {
                    WHERE("m_type = #{mType}");
                }
                if (notice.getFlage() != null) {
                    WHERE("flage = #{flage}");
                }
            }
        };
        System.out.println(sql);
        return sql.toString();
    }
}
